<?php

namespace summer\swoole\pool\log;

class Logger
{
    private static $instance = null;

    public static function getInstance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new self();
        }

        return self::$instance;
    }

    private function __construct()
    {

    }

    public function error($message, array $context = array())
    {
        $messagePrefix = '[' . date('Y-m-d H:i:s') . '][ERROR]';
        fputs(STDOUT, $messagePrefix . $message . "\n");
    }

    public function warning($message, array $context = array())
    {
        $messagePrefix = '[' . date('Y-m-d H:i:s') . '][WARNING]';
        fputs(STDOUT, $messagePrefix . $message . "\n");
    }
}